<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<!--<标签名 key="value">innerText</标签名>-->
<div id="num" style="display: inline-block;">0</div>
<input type="button" value="点击加一" onclick="add()"></input>
</body>
<script>
  function add() {
    // 获取对应的div的值
    let numDiv = document.getElementById('num')
    let num = parseInt(numDiv.innerText)
    // add的操作
    num++
    // 将值重新赋予div
    numDiv.innerText = num.toString()
  }
</script>
</html>
